﻿<div bsModal #createOrEditModal="bs-modal" (onShown)="onShown()" class="modal fade" tabindex="-1" role="dialog"
    aria-labelledby="createOrEditModal" aria-hidden="true" [config]="{backdrop: 'static', keyboard: !saving}">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <form *ngIf="active" #userForm="ngForm" novalidate (ngSubmit)="save()" autocomplete="off">
                <div class="modal-header">
                    <h4 class="modal-title">
                        <span *ngIf="formData.id">编辑</span>
                        <span *ngIf="!formData.id">新建</span>
                    </h4>
                    <button type="button" class="close" (click)="close()" [attr.aria-label]="l('Close')"
                        [disabled]="saving">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <tabset class="tab-container tabbable-line">
                        <tab heading="需求详细信息" customClass="m-tabs__item">
                            <div class="row">
                                <div class="col-sm-6">
                                    <div class="form-group">
                                        <label for="standardPartsDetailId">编码 *</label><br>
                                        <p-autoComplete [(ngModel)]="standardPartsDetailIdAuto"
                                            name="standardPartsDetailIdAuto" [suggestions]="standardPartsFiltered"
                                            (completeMethod)="filter($event)" [size]="42" [minLength]="1" placeholder=""
                                            [dropdown]="true" class="autoCompleteClass">
                                            <ng-template let-brand pTemplate="item">
                                                <div class="ui-helper-clearfix">
                                                    <div style="font-size:12px;float:right;margin:10px 10px 0 0">
                                                        {{brand.serialNumber}}</div>
                                                    <div style="font-size:14px;float:right;margin:10px 10px 0 0">
                                                        {{brand.features.displayName}}/{{brand.features.specification}}/{{brand.features.standardNumber}}/{{brand.features.materials}}
                                                    </div>
                                                </div>
                                            </ng-template>
                                        </p-autoComplete>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <div class="form-group">
                                        <label for="unitOfUsing">车间 *</label>
                                        <select name="unitOfUsing" class="form-control"
                                            [(ngModel)]="formData.usableRange.unitOfUsing" required>
                                            <option *ngFor="let optionItem of unitOfUsings"
                                                [value]="optionItem.value">{{optionItem.name}}</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-sm-6">
                                    <div class="form-group">
                                        <label for="requiredQuantityOfModel">型号需求数量 *</label>
                                        <input id="requiredQuantityOfModel" #requiredQuantityOfModelInput="ngModel"
                                            type="number" name="requiredQuantityOfModel" class="form-control"
                                            [(ngModel)]="formData.requiredQuantityOfModel" required
                                            oninput="if(value.length>9)value=value.slice(0,9)">
                                        <validation-messages [formCtrl]="requiredQuantityOfModelInput">
                                        </validation-messages>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <div class="form-group">
                                        <label for="planDate">型号需求时间 *</label>
                                        <input id="planDate" #planDateInput="ngModel" type="text" name="planDate"
                                            class="form-control" [(ngModel)]="planDate" readOnly="true" bsDatepicker
                                            data-date-format="yyyy-mm-dd">
                                        <validation-messages [formCtrl]="planDateInput"></validation-messages>
                                    </div>
                                </div>
                            </div>
                        </tab>
                    </tabset>
                </div>
                <div class="modal-footer">
                    <button [disabled]="saving" type="button" class="btn btn-default"
                        (click)="close()">{{"Cancel" | localize}}</button>
                    <button *ngIf="rquirementPackageDto.state == 0" type="submit" class="btn btn-primary"
                        [disabled]="!userForm.form.valid" [buttonBusy]="saving" [busyText]="l('SavingWithThreeDot')"><i
                            class="fa fa-save"></i> <span>{{"Save" | localize}}</span></button>
                </div>
            </form>
        </div>
    </div>
</div>